POV-Ray : Newsgroups : povray.beta-test : Function parameter bug : Re: Function parameter bug Server Time
30 Jul 2024 20:31:08 EDT (-0400)
  Re: Function parameter bug  
From: Rune
Date: 27 Oct 2001 13:05:52
Message: <3bdae970@news.povray.org>
"Thorsten Froehlich" wrote:
> You still did not understand which means I am not able
> to explain it well enough :-(

I still don't understand I'm afraid. In this one-line example:

#declare foo = function(C) {C*2}

C is not defined before the function. C *is* defined inside the function
{...} brackets. C is not defined after the function brackets. If that
doesn't mean that C is local to the function, then what does it mean?

> #declare foo = function(a,b,c)
> {
>     a +
>     #declare b = 5;
>     c + b // What is 'b' now assuming either model of operation???
> }
>
> Currently the answer is:  'b' will be substituted by '5'

That's what I want too. Only if B is declared *before* the function it
shouldn't affect the function, like here:

> #declare b = 5;
> #declare foo = function(a,b,c)
> {
>     a + c + b // What is 'b' now assuming either model of operation???
> }
> #declare q = foo(7,8,9)

In this example an error occurs, but I would like the b in the function to
be substituted with the b parameter fed to the function when it is invoked
(ie. 8), not the b variable declared before the function.

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:    http://rsj.mobilixnet.dk (updated June 26)
POV-Ray Users:   http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.